'use strict';
/* Controllers */
app.controller('fundMemberCtrl', ['$scope', '$http', '$state', 'apiService','$cookieStore','$timeout','toaster', function ($scope, $http, $state, apiService,$cookieStore,$timeout,toaster) {
    $scope.search_obj = {
        username: '',
        company: 3,
        rows: 1,
        pageSize: 10
    };

    $scope.paginationConf = {
        currentPage: 1,
        totalItems: 66,
        itemsPerPage: $scope.search_obj['pageSize'],
        perPageOptions: [10, 20, 30, 40, 50],
        onChange: function () {
            $scope.search_obj['rows'] = $scope.paginationConf.currentPage;
            // 获取非会员列表
            apiService.post({
                modelName: 'account',
                apiName: 'getAccountByLike'
            }, $scope.search_obj, function (data) {
                if (data.code == 200) {
                    $scope.pageData = data['data']['list'];
                    $scope.paginationConf.totalItems = data['data']['total']? data['data']['total']:0;
                } else {
                    toaster.pop('error', '提示', data['msc']);
                }
            }, function (err) {
                toaster.pop('error', '提示', '服务器出小差咯...');
            });
        }
    };

    $scope.searchFun = function () {
        $scope.paginationConf.onChange();
    }
}]);